Skip to content

Conversation

@zamulla
Copy link
Collaborator

@zamulla zamulla commented Dec 12, 2025

No description provided.

@zamulla zamulla requested a review from terrakok December 16, 2025 13:30

```text
[versions]
compose-multiplatform-navigation3 = "1.0.0-alpha05"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name it just multiplatform-nav3 and multiplatform-nav3-ui


> While Navigation 3 is released as two artifacts, `navigation3:navigation3-ui` and `navigation3:navigation3-common`,
> only `navigation-ui` needs a separate Compose Multiplatform implementation.
> A dependency on `navigation3-common` is added implicitly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added transitively

```

Finally, you can try out the [proof-of-concept library](https://github.com/terrakok/navigation3-browser)
authored by a JetBrains engineer that adds support for Navigation 3 to web targets:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the library already supports web targets. my library adds an integration with browser history buttons

@zamulla zamulla marked this pull request as ready for review December 16, 2025 14:17
@zamulla zamulla requested a review from a team as a code owner December 16, 2025 14:17
@zamulla zamulla requested a review from terrakok December 16, 2025 14:17
Copy link
Collaborator

@ElviraMustafina ElviraMustafina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the comment overload, got a bit too enthusiastic

[//]: # (title: Navigation 3 in Compose Multiplatform)
<primary-label ref="alpha"/>

[Android's Navigation library](https://developer.android.com/guide/navigation) is upgraded to Navigation 3, a redesigned approach to navigation that works with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[Android's Navigation library](https://developer.android.com/guide/navigation) is upgraded to Navigation 3, a redesigned approach to navigation that works with
[Android's Navigation library](https://developer.android.com/guide/navigation) has been upgraded to Navigation 3, introducing a redesigned approach to navigation that works with


[Android's Navigation library](https://developer.android.com/guide/navigation) is upgraded to Navigation 3, a redesigned approach to navigation that works with
Compose and takes into account feedback to the previous version of the library.
Starting with the version 1.10, Compose Multiplatform helps adopt Navigation 3 into multiplatform projects on all supported platforms:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Starting with the version 1.10, Compose Multiplatform helps adopt Navigation 3 into multiplatform projects on all supported platforms:
Starting with version 1.10, Compose Multiplatform simplifies adopting Navigation 3 in multiplatform projects for all supported platforms:

## General overview

Navigation 3 is more than a new version of the library — in a lot of ways it's a new library entirely.
To dive deeper into the philosophy behind it, see the [Android Developers blog post](https://android-developers.googleblog.com/2025/05/announcing-jetpack-navigation-3-for-compose.html).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To dive deeper into the philosophy behind it, see the [Android Developers blog post](https://android-developers.googleblog.com/2025/05/announcing-jetpack-navigation-3-for-compose.html).
To learn more about the philosophy behind this redesign, see the [Android Developers blog post](https://android-developers.googleblog.com/2025/05/announcing-jetpack-navigation-3-for-compose.html).

Navigation 3 is more than a new version of the library — in a lot of ways it's a new library entirely.
To dive deeper into the philosophy behind it, see the [Android Developers blog post](https://android-developers.googleblog.com/2025/05/announcing-jetpack-navigation-3-for-compose.html).

The major changes in the new library are:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The major changes in the new library are:
Key changes in Navigation 3 include:

The major changes in the new library are:

* **User-owned back stack**. Instead of operating a single library back stack,
you create and manage a `SnapshotStateList` of states which is observed by the UI.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one (feels like "Big UI is Watching You")

Suggested change
you create and manage a `SnapshotStateList` of states which is observed by the UI.
you create and manage a `SnapshotStateList` of states, which the UI observes directly.

Comment on lines +69 to +70
Navigation 3 is closely aligned with Compose and therefore a navigation implementation written for Android works in common
Compose Multiplatform code almost without changes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Navigation 3 is closely aligned with Compose and therefore a navigation implementation written for Android works in common
Compose Multiplatform code almost without changes.
Navigation 3 is closely aligned with Compose, allowing an Android navigation implementation to work in common
Compose Multiplatform code with minimal changes.


Navigation 3 is closely aligned with Compose and therefore a navigation implementation written for Android works in common
Compose Multiplatform code almost without changes.
The only thing you need to add to support non-JVM platforms like web and iOS is implement
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The only thing you need to add to support non-JVM platforms like web and iOS is implement
To support non-JVM platforms like web and iOS, the only thing you need is to implement

To take this into account, the library has two overloads for the `rememberNavBackStack()` function:

* [The first overload](https://developer.android.com/reference/kotlin/androidx/navigation3/runtime/package-summary#rememberNavBackStack(kotlin.Array))
only takes a set of `NavKey` and requires a reflection-based serializer.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set of NavKey elements? values?

also takes a `SavedStateConfiguration` parameter that allows you to provide a `SerializersModule` and handle open polymorphism
correctly across all platforms.

In the multiplatform examples of Navigation 3 it can look [like this](https://github.com/terrakok/nav3-recipes/blob/8ff455499877225b638d5fcd82b232834f819422/sharedUI/src/commonMain/kotlin/com/example/nav3recipes/basicdsl/BasicDslActivity.kt#L40):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In the multiplatform examples of Navigation 3 it can look [like this](https://github.com/terrakok/nav3-recipes/blob/8ff455499877225b638d5fcd82b232834f819422/sharedUI/src/commonMain/kotlin/com/example/nav3recipes/basicdsl/BasicDslActivity.kt#L40):
In the Navigation 3 multiplatform examples, polymorphic serialization can look [like this](https://github.com/terrakok/nav3-recipes/blob/8ff455499877225b638d5fcd82b232834f819422/sharedUI/src/commonMain/kotlin/com/example/nav3recipes/basicdsl/BasicDslActivity.kt#L40):

Comment on lines +123 to +124
Sometimes this documentation uses Android-only examples,
but fundamental guidance and navigation principles are the same for Multiplatform:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sometimes this documentation uses Android-only examples,
but fundamental guidance and navigation principles are the same for Multiplatform:
While some of the documentation uses Android-specific examples,
the core concepts and navigation principles remain consistent across all platforms:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants